const Router = require('koa-router');
const { verifyAuth, verifyPermission } = require('../middleware/auth.middleware');
const { create, reply, remove, list } = require('../controller/comment.controller.js');
const { support } = require('../controller/support.controller');

const commentRouter = new Router({ prefix: '/comment' });

// 创建一条评论
commentRouter.post("/", verifyAuth, create);
// 回复一条评论
commentRouter.post("/:commentId/reply", verifyAuth, reply);
// 删除一条评论
commentRouter.delete("/:commentId", verifyAuth, verifyPermission, remove);
// 点赞一条评论 / 取消点赞
commentRouter.get("/:commentId/support", verifyAuth, support);
// 返回评论列表
commentRouter.get("/", list);

module.exports = commentRouter;
